*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    min-height: 100vh;
    background: linear-gradient(45deg,#ff216d,#2196f3);
}
.nav{
    position: fixed;
    top: 20px;
    right: 20px;
    height: 20px;
    width: 250px;
    z-index: 100;
}
.toggle{
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #fff;
    /* 小手 */
    cursor: pointer;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    color: #ff216d;
    padding: 5px 20px;
}
.toggle::before{
    content: 'Menu 菜单';
    margin-right: 10px;

}
.toggle.active::before{
    content: '关闭';
}
.toggle span{
    position: relative;
    width: 20px;
    height: 50px;
}

.toggle span::before{
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ff216d;
    transition: .5s;

}
.toggle span::after{
    content: '';
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ff216d;
    transition: .5s;
}

.toggle.active span::before{
    transform: rotate(225deg);
    top: 24px;
}
.toggle.active span::after{
    transform: rotate(135deg);
    bottom: 24px;
}
ul{
    position: relative;
    list-style: none;
    display: flex;
    /* 设置列方向为主轴 */
    flex-direction: column;
}

ul li{
    position: relative;
    list-style: none;
    transition: .5s;
    /* 先隐藏 */
    visibility: hidden;
    opacity: 0;
    transform: translateX(-250px);
    transition-delay: calc(0.1s*var(--i));
}

/* active类情况 */
.nav.active ul li{
    visibility: visible;
    opacity: 1;
    transform: translateX(0px);
}

ul li a{
    position: relative;
    text-decoration: none;
    display: block;
    padding: 10px 20px;
    height: 50px;
    background: #fff;
    color: #333;
    transition: .5s;
}
ul li a:hover{
    background: #f6f6f6;
    color:#20b7ff ;
    transition: 0s;
}


